import request from '@/utils/request'
// 注册接口
export const userRegisterService = (formModel) => {
  const params = new URLSearchParams()
  for (let key in formModel) {
    params.append(key, formModel[key])
  }
  return request.post('/user/register', params)
}

// 登录接口
export const userLoginService = (loginData) => {
  const params = new URLSearchParams()
  for (let key in loginData) {
    params.append(key, loginData[key])
  }
  return request.post('/user/login', params)
}

// 获取用户基本信息
export const userGetInfoService = () => request.get('/user/userInfo')

// 修改个人信息
export const userInfoUpdateService = (userInfoData) =>
  request.put('/user/update', userInfoData)

// 更新用户密码
export const userUpdatePasswordService = ({ old_pwd, new_pwd, re_pwd }) =>
  request.patch('/user/updatePwd', { old_pwd, new_pwd, re_pwd })
